{extend name="public/base"}

{block name="x-body"}
<div class="x-body">
    <div class="layui-row">
    </div>
    <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll('{:url(\'MallConfig/shipping_del\')}')"><i class="layui-icon"></i>批量删除</button>
        <button class="layui-btn" onclick="x_admin_show('添加快递','{:url(\'MallConfig/shipping_form\')}')"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">共有数据：{$list -> total()} 条</span>
    </xblock>
    <table class="layui-table layui-form">
        <thead>
        <tr>
            <th width="20">
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>物流公司名称</th>
            <th>快递公司编码</th>
            <th width="50">状态</th>
            <th>操作</th>
        </thead>
        <tbody>
        {volist name="list" id="v"}
        <tr>
            <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$v.id}'><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$v.id}</td>
            <td>{$v.shipping_name}</td>
            <td>{$v.shipping_code}</td>
            <td>
                <input type="checkbox" name="switch" data-id="{$v.id}" data-status="{$v.is_open}" lay-text="开|关" {if $v.is_open == 1}checked=""{/if} lay-skin="switch">
            </td>
            <td class="td-manage">
                <a title="编辑"  onclick="x_admin_show('编辑快递', '{:url(\'MallConfig/shipping_form\', [\'id\' => $v.id])}')" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>
                </a>
                <a title="删除" onclick="member_del(this,'{$v.id}', '{:url(\'MallConfig/shipping_del\')}')" href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>
                </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page">
        <div>
            {$list -> render()|raw}
        </div>
    </div>
</div>

<script>
    $(document).ready(function (){
        var url = '{:url("MallConfig/shipping")}';
        /**
         * 更新排序
         */
        sort(url);

        /**
         * 更新状态
         */
        editStatus('{:url("MallConfig/shipping_status")}', 'is_open');
    });
</script>
{/block}